<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="EditPost.aspx.cs" Inherits="FreeLancer.HRB.WebApp.Admin.Pages.EditPost" Title="<%$ Resources:labels, editPost %>" %>

<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.1, Version=8.1.1.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5"
  Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>

<%@ Register Assembly="DevExpress.Web.v8.1, Version=8.1.1.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5"
  Namespace="DevExpress.Web.ASPxUploadControl" TagPrefix="dxuc" %>
<%@ Register Assembly="DevExpress.Web.ASPxHtmlEditor.v8.1, Version=8.1.1.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5"
  Namespace="DevExpress.Web.ASPxHtmlEditor" TagPrefix="dxhe" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <script type="text/javascript" src="../../javascript/admin.js"></script>
  <div>
    <div style="margin-bottom: 10px;">
      <span><%=Resources.labels.title %></span>
      <asp:TextBox runat="server" ID="txtTitle" Width="250px"></asp:TextBox>
      <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
        ControlToValidate="txtTitle" Display="Dynamic" ErrorMessage="<%$ Resources:labels, titleReqMsg %>" />
      &nbsp;&nbsp;&nbsp;
      <span><%=Resources.labels.category %></span>
      <asp:DropDownList runat="server" ID="cboCategory" Width="200px">
        <%--<asp:ListItem Selected="True" Value="0" Text="<%$ Resources:labels, noneItem %>"></asp:ListItem>--%>
      </asp:DropDownList>
      &nbsp;&nbsp;&nbsp;
      <span runat="server" id="lblLanguage"><%=Resources.labels.language %></span>
      <asp:DropDownList runat="server" ID="cboLanguage" Width="100px" 
        >
      </asp:DropDownList>
      &nbsp;&nbsp;&nbsp;
      <asp:Label runat="server" ID="lblUpdateAt"><%=Resources.labels.updateAt %></asp:Label>
      <asp:Label runat="server" ID="lblTime"></asp:Label>
    </div>
    <div id="Editor" style="margin-bottom: 10px;">
      <dxhe:ASPxHtmlEditor ID="ASPxHtmlEditor" runat="server" Width="950px" Height="370px">
        <SettingsImageUpload UploadImageFolder="/Images/PostImages/">
          <ValidationSettings AllowedContentTypes="image/jpeg,image/pjpeg,image/gif,image/png,image/x-png"
            NotAllowedContentTypeErrorText="<%$ Resources:labels, notAllowedContentTypeErrorText %>" 
            FileDoesNotExistErrorText="<%$ Resources:labels, fileDoesNotExistErrorText %>"
            MaxFileSize="1000000"
            MaxFileSizeErrorText="<%$ Resources:labels, maxFileSizeErrorText %>">
          </ValidationSettings>
        </SettingsImageUpload>
      </dxhe:ASPxHtmlEditor>
    </div>
    <table id="entrySettings">
      <tr>
        <td class="label"><%--<%=Resources.labels.slug %>--%></td>
        <td>
          <asp:TextBox runat="server" ID="txtSlug" Width="400px" Visible="false"/>
        </td>
        <td>
          <%--<a href="#"><%=Resources.labels.extractFromTitle %></a>--%>
        </td>
      </tr>    
      <tr  style="vertical-align:top;">
        <td class="label"><%=Resources.labels.description %></td>
        <td><asp:TextBox runat="server" ID="txtDescription" Width="400" TextMode="multiLine" Columns="50" Rows="4" /></td>
        <td>
          <dxe:ASPxImage ID="ASPxImage" runat="server" 
            ClientInstanceName="ciEditPost_ASPxImage" 
            Height="80px" Width="120px">
          </dxe:ASPxImage>
        </td>
      </tr>
      <tr>
        <td>
          <span><%=Resources.labels.descriptionImage %></span>
        </td>
        <td>
          <table>
            <tr>
              <td>
                <dxuc:ASPxUploadControl ID="ASPxUploadControl" runat="server"
                  OnFileUploadComplete="ASPxUploadControl_FileUploadComplete" 
                  ClientInstanceName="ciEditPost_ASPxUploadControl" Width="50px">
                  <ValidationSettings AllowedContentTypes="image/jpeg,image/pjpeg,image/gif,image/png,image/x-png"
                    NotAllowedContentTypeErrorText="<%$ Resources:labels, notAllowedContentTypeErrorText %>" 
                    FileDoesNotExistErrorText="<%$ Resources:labels, fileDoesNotExistErrorText %>"
                    MaxFileSize="1000000"
                    MaxFileSizeErrorText="<%$ Resources:labels, maxFileSizeErrorText %>">
                  </ValidationSettings>
                  <ClientSideEvents FileUploadComplete="function(s,e) { ciEditPost_ASPxUploadControl_FileUploadComplete(s,e); }"/>
                </dxuc:ASPxUploadControl>
              </td>
              <td>
                <dxe:ASPxButton ID="ASPxButtonUpload" runat="server" Text="<%$ Resources:labels, btnUploadText %>" AutoPostBack="false">
                  <ClientSideEvents Click="function(s,e) { ciEditPost_ASPxButtonUpload_Click(s,e); }"/>
                </dxe:ASPxButton>
              </td>
            </tr>
          </table>
        </td>
        <td>
          <dxe:ASPxTextBox ID="ASPxTextBoxImageName" runat="server" ClientInstanceName="ciEditPost_ASPxTextBoxImageName" 
            ReadOnly="true" Border-BorderStyle="None" BackColor="Transparent" ForeColor="#f1f1f1" Width="0px">
          </dxe:ASPxTextBox>
        </td>
      </tr>
      <tr>
        <td>
          <span><%=Resources.labels.attachedFile %></span>
        </td>
        <td>
          <asp:CheckBox ID="chkUploadedFile" runat="server" Visible="false"/>
          <asp:HyperLink ID="linkUploadedFile" runat="server" Visible="false"></asp:HyperLink>
          <dxuc:ASPxUploadControl ID="ASPxUploadControlFile" runat="server"
            OnFileUploadComplete="ASPxUploadControlFile_FileUploadComplete" 
            ClientInstanceName="ciEditPost_ASPxUploadControlFile" Width="50px">
            <ValidationSettings
              NotAllowedContentTypeErrorText="<%$ Resources:labels, notAllowedContentTypeErrorText %>" 
              FileDoesNotExistErrorText="<%$ Resources:labels, fileDoesNotExistErrorText %>"
              MaxFileSize="1000000"
              MaxFileSizeErrorText="<%$ Resources:labels, maxFileSizeErrorText %>">
            </ValidationSettings>
          </dxuc:ASPxUploadControl>
        </td>
      </tr>
      <%--<tr>
        <td class="label"><%=Resources.labels.keywords %></td>
        <td><asp:TextBox runat="server" ID="txtKeyword" Width="400" /></td>
      </tr>--%>
      <tr>
        <td class="label"><%=Resources.labels.settings %></td>
        <td><asp:CheckBox runat="Server" ID="chkIsPublished" Checked="true" Text="<%$ Resources:labels, approved %>" /></td>
      </tr>
      <tr>
        <td></td>
        <td><asp:CheckBox runat="Server" ID="chkIsCommentAllowed" Checked="true" Text="<%$ Resources:labels, isCommentAllowed %>" /></td>
      </tr>
    </table>  
    
    <div style="text-align:right">
      <asp:Label runat="server" ID="lblError"></asp:Label>
      <asp:Label runat="server" ID="lblInfo"></asp:Label>
      <asp:Button runat="server" ID="btnSave" Text="<%$ Resources:labels, cmdUpdate %>" OnClick="btnSave_Click"/>
    </div>
    <div style="text-align:right; color:Red; margin-top: 10px;">
      <asp:Label runat="server" ID="lblErrorUpdateFailed" Visible="false"
        Text="<%$ Resources:labels, infoUpdateFailed %>"></asp:Label>
      <asp:Label runat="server" ID="lblErrorLoadFailed" Visible="false"
        Text="<%$ Resources:labels, infoLoadFailed %>"></asp:Label>
    </div>
  </div>
</asp:Content>
